<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 这样默认调用的是get:方法  -->
    <!-- 有set方法之后，可以在浏览器修改fullname的值 -->
    <div id="hello">{{fullname}}</div>
    <script src="../vue.js"></script>
    <script>
        const vue01 = new Vue({
            el: '#hello',
            data:{
                firstname:"lin",
                lastname:"zejia",
            },
           computed:{
               fullname:{
                   get:function(){
                       return this.firstname+" "+this.lastname;
                   },
                   set:function(canshu){
                    const arr  = canshu.split(" ");
                    this.firstname = arr[0];
                    this.lastname = arr[arr.length-1];
                   }
               }
           }
        })
    </script>
</body>

</html>